All Questions
4 questions
0votes
3answers
268views
Resolving function calls as function arguments using a stack
After doing a bit of reading, I have a vague understanding of the use of a stack in calling functions when one function calls another, where the arguments are placed on the stack for the called ...
9votes
1answer
7kviews
Why is a frame pointer set as an offset from the stack pointer? [duplicate]
I'm trying to understand how stack frames are constructed and have run into this description on wikipedia: The locations of all other fields in the frame can be defined relative either to the top ...
33votes
6answers
9kviews
Why do programs use call stacks, if nested function calls can be inlined?
Why not have the compiler take a program like this: function a(b) { return b^2 }; function c(b) { return a(b) + 5 }; and convert it into a program like this: function c(b) { return b^2 + 5 }; ...
26votes
4answers
109kviews
Understanding stack frame of function call in C/C++?
I am trying to understand how stack frames are built and which variables (params) are pushed to stack in what order? Some search results showed that the C/C++ compiler decides based on operations ...